﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage/AdminMasterPage.master" AutoEventWireup="true" CodeFile="SAPFin005b.aspx.cs" Inherits="Admin_SAPFin_SAPFin005b" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phScript" runat="Server">
    <link href="../../Plugin/font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet" />
    <script type="text/javascript" src="/Scripts/Controls/DatePicker/WdatePicker.js""></script>
    <style type="text/css">
        .subTable
        {
            border: none !important;
        }

            .subTable td
            {
                border: none !important;
                padding-right: 8px;
            }
    </style>
    <script type="text/javascript">
        $(function () {
            $("i[data-hid]").each(function () {
                $(this).click(function () {
                    var did = $(this).attr("data-hid");

                    $("[data-id='" + did + "']").each(function () {
                        $(this).toggle();
                    });
                });
            });

            $("#chk_sel_all").change(function () {
                var isChecked = $(this).is(":checked");

                $(".sel_class>input[type='checkbox']").each(function () {
                    $(this).attr("checked", isChecked);
                });

            });

            $("#btnBatch").click(function () {
                var selIds = "";
                $(".sel_class>input[type=checkbox]").each(function () {
                    if ($(this).is(":checked")) {
                        selIds += $(this).prev().val() + ",";
                    }
                });
                if (selIds.length == 0) {
                    alert("请选择您要批量修改的凭证!");
                    return false;
                }
                else {
                    OpenWindow("凭证批量修改", "B", "/Admin/SAPFin/SAPFin002e.aspx?type=B&ids=" + selIds, 700, 680);
                }
                return false;
            });

        });


        function AddBox() {
            var checkList = $(".pagnationtable input:checked");
            if (checkList.length > 0) {
                if (confirm("您确定要将所选的凭证加入该凭证盒？")) {
                    var ids = "";
                    checkList.each(function () {
                        if ($(this).attr("id").indexOf("all") < 0)
                        { ids += $(this).attr("id").replace("chk_sel", "") + ","; }
                    });
                    $("#<%=HiddenFieldIds.ClientID%>").val(ids);
                    $("#<%=btnDelete.ClientID%>").click();

                    //window.location.href = "SAPFin002c.aspx?ids=" + ids + "&BoxId=<%=boxId%>";
                    //alert(ids);
                }
            }
            else {
                alert("请选择您要加入该凭证盒的凭证!");
            }
        }

        function batView() {
            var checkList = $(".pagnationtable input:checked");
            if (checkList.length > 0) {
                checkList.each(function () {
                    id = $(this).attr("id").replace("chk_sel", "");
                    $("#i" + id).click();
                });
            }
            return false;
        }

        function batDelete() {
            var checkList = $(".pagnationtable input:checked");
            if (checkList.length > 0) {
                if (confirm("您确定要将所选的凭证移除该凭证盒，移出后凭证盒信息将重新生成？")) {
                    var ids = "";
                    checkList.each(function () {
                        if ($(this).attr("id").indexOf("all") < 0)
                        { ids += $(this).attr("id").replace("chk_sel", "") + ","; }
                    });
                    $("#<%=HiddenFieldIds.ClientID%>").val(ids);
                    $("#<%=btnDelete.ClientID%>").click();
                }
            }
            else {
                alert("请选择您要加入该凭证盒的凭证!");
            }
            return false;
        }

        function Delete(ids) {
            if (confirm("您确定要将该凭证移出该凭证盒，移出后凭证盒信息将重新生成？")) {
                $("#<%=HiddenFieldIds.ClientID%>").val(ids);
                $("#<%=btnDelete.ClientID%>").click();
            }
            return false;
        }

        function searchDiv() {
            $("#tbSearch").toggle("fast");
            if ($("#divButton").hasClass("open")) {
                $("#divButton").removeClass("open");
                $("#divButton").addClass("close")
            }
            else {
                $("#divButton").removeClass("close");
                $("#divButton").addClass("open")
            }

        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 100%; min-width: 700px">
            <div class="searchBox">
                <div class="sb1">搜索条件</div>
                <div class="sb2 close" onclick="searchDiv()" id="divButton"></div>
            <table width="100%" cellspacing="2" cellpadding="2" id="tbSearch" class="close">
                <tr>
                    <td>文档描述:</td>
                    <td>
                        <yncWebDDL:DrpCodeTable ID="drpDocType" runat="server" Category="CTE006" ShowSelectedItem="true"  Required="true">
                         </yncWebDDL:DrpCodeTable>
                    </td>
                    <td>凭证号:</td>
                    <td>
                        <yncWeb:yncTextBox ID="txtKey" runat="server"></yncWeb:yncTextBox>
                    </td>
                </tr>
                <tr>
                    <td width="100px">
                        文档日期:
                    </td>
                    <td colspan="3">
                       <span style="color: #000;">
                       <input class="Wdate textBox" style="width: 180px;" runat="server" readonly="readonly"
                         type="text" id="txtDocumentStartDate" clientidmode="Static" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'txtDocumentEndDate\')||$dp.$DV(\'9998-12-31\')}'})" />&nbsp;&nbsp;至&nbsp;&nbsp;
                       <input class="Wdate textBox" runat="server" readonly="readonly" type="text" id="txtDocumentEndDate"
                         clientidmode="Static" style="width: 180px;" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtDocumentStartDate\');}',maxDate:'9998-12-31'})" />
                      </span>
                    </td>
                </tr>
                <tr>
                    <td width="100px">
                        初次入库日期:
                    </td>
                    <td colspan="3">
                       <span style="color: #000;">
                        <input class="Wdate textBox" style="width: 180px;" runat="server" readonly="readonly"
                        type="text" id="txtStoreStartDate" clientidmode="Static" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'txtStoreEndDate\')||$dp.$DV(\'9998-12-31\')}'})" />&nbsp;&nbsp;至&nbsp;&nbsp;
                        <input class="Wdate textBox" runat="server" readonly="readonly" type="text" id="txtStoreEndDate"
                        clientidmode="Static" style="width: 180px;" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtStoreStartDate\');}',maxDate:'9998-12-31'})" />
                       </span>
                    </td>
                </tr>
                <tr>
                    <td>公司名称:</td>
                    <td>
                       <yncWebDDL:DrpCompany ID="drpCompany" runat="server"  ShowSelectedItem="true" Enabled="false">
                       </yncWebDDL:DrpCompany>
                    </td>
                    <td>职能部门:</td>
                    <td>
                        <yncWebDDL:DrpCodeTable ID="drpFunctionDept" runat="server" Category="CTE001" ShowSelectedItem="true">
                        </yncWebDDL:DrpCodeTable>
                    </td>
                </tr>
                
                <tr>
                    <td width="100px">
                        录入时间:
                    </td>
                    <td colspan="3">
                       <span style="color: #000;">
                    <input class="Wdate textBox" style="width: 180px;" runat="server" readonly="readonly"
                        type="text" id="txtStartDate" clientidmode="Static" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'txtEndate\')||$dp.$DV(\'9998-12-31\')}'})" />&nbsp;&nbsp;至&nbsp;&nbsp;
                    <input class="Wdate textBox" runat="server" readonly="readonly" type="text" id="txtEndate"
                        clientidmode="Static" style="width: 180px;" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtStartDate\');}',maxDate:'9998-12-31'})" />
                </span>
                   
                    </td>
                </tr>
                <tr>
                    <td>用户名(SAP):</td>
                    <td>
                        <yncWeb:yncTextBox ID="txtUserName" runat="server"></yncWeb:yncTextBox>
                    </td>
                    <td>凭证类型(SAP):</td>
                    <td>
                        <yncWeb:yncTextBox ID="txtDocumentsType" runat="server"></yncWeb:yncTextBox>
                    </td>
                </tr>
                <tr>
                    <td>业务类型(SAP):</td>
                    <td>
                        <yncWeb:yncTextBox ID="txtReferenceTransact" runat="server"></yncWeb:yncTextBox>
                    </td>
                    <td>凭证系统(SAP):</td>
                    <td>
                        <yncWeb:yncTextBox ID="txtDocumentSystem" runat="server"></yncWeb:yncTextBox>
                    </td>
                </tr>
                <tr>
                    <td>关联系统(SAP):</td>
                    <td colspan="3">
                        <yncWeb:yncTextBox ID="txtLogicalSystem" runat="server"></yncWeb:yncTextBox>
                         <span style="margin-left:8px">
                    <asp:Button id="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" /></span>
                    </td>
                </tr>
            </table>
        </div>
        <table width="100%" cellspacing="2" cellpadding="2" class="menu" align="left" style="margin-top:10px;">
            <td style="width:3px;">
                &nbsp;
            </td>
            <td class="td">
                <a class="add" href="SAPFin005c.aspx?boxId=<%=boxId %>&companyName=<%=companyName %>&companyCode=<%=companyCode %>">添加凭证入档案盒</a>
                <a class="delete" onclick="batDelete();" href="#">批量移出档案盒</a>
                <a class="view" onclick="batView();" href="#">批量查看</a>
                <a class="back" href="SAPFin005.aspx">返回</a>
            </td>
        </table>
        <yncWeb:PagnationGrid PageSize="100" ID="pageGrid" runat="server" OnOnPageIndexChange="PageChanged">
            <HeaderTemplate>
                <table width="2080px" cellspacing="0" cellpadding="0" class="pagnationtable" align="left" style="table-layout:fixed">
                    <thead>
                        <tr>
                            <th width="80px"><asp:CheckBox ID="chk_sel_all" ClientIDMode="Static" runat="server" Text="序号" />
                            </th>
                            <th width="40px">操作</th>
                            <th width="40px">SAP?</th>
                            <th width="90px">凭证盒条码
                            </th>
                            <th width="90px">外仓条形码
                            </th>
                            <th width="200px">文档描述
                            </th>
                            <th width="150px"><a class="thTitle" href="#" onclick="return false;" title="Posting Date in SAP">凭证入帐日期(SAP)</a>
                            </th>
                            <th width="150px"><a class="thTitle" href="#" onclick="return false;" title="Document Number in SAP">凭证索引号1(SAP)</a>
                            </th>
                            <th width="150px"><a class="thTitle" href="#" onclick="return false;" title="Reference in SAP">凭证索引号2(SAP)</a>
                            </th>
                            <th width="150px"><a class="thTitle" href="#" onclick="return false;" title="Reference Key in SAP">凭证索引号3(SAP)</a>
                            </th>
                            <th width="150px"><a class="thTitle" href="#" onclick="return false;" title="Document Header in SAP">凭证索引号4(SAP)</a>
                            </th>
                            <th width="100px"><a class="thTitle" href="#" onclick="return false;" title="Company Code in SAP">公司代码(SAP)</a>
                            </th>
                            <th width="100px">公司名称
                            </th>
                            <th width="100px">职能部门
                            </th>
                            <th width="100px">实物存储状态
                            </th>
                            <th width="100px">实物存储地点
                            </th>
                            <th width="100px">电子存储状态
                            </th>
                            <th width="100px">初次入库时间
                            </th>
                            <th width="100px">已保管期限
                            </th>
                            <th width="100px">应保管期限
                            </th>
                            <th width="100px">销毁时间
                            </th>
                            <th width="200px">备注
                            </th>
                            
                        </tr>
                    </thead>
                    <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td class="sel_class">
                       <input type="hidden" id="h<%# Eval(FinReceiptMetadata.ColumnNames.ReceiptID) %>"  value="<%# Eval(FinReceiptMetadata.ColumnNames.ReceiptID) %>"/>
                        <input type="checkbox" id="chk_sel<%# Eval(FinReceiptMetadata.ColumnNames.ReceiptID) %>" />
                        <asp:Label ID="lbReceiptID" runat="server" Visible="false" Text = "<%# Eval(FinReceiptMetadata.ColumnNames.ReceiptID) %>"></asp:Label>
                        <i id="i<%# Eval(FinReceiptMetadata.ColumnNames.ReceiptID) %>" class="fa fa fa-info-circle" style="cursor:pointer;" data-hid="d<%# Container.ItemIndex +1 %>" ></i> <%# Container.ItemIndex +1+ (this.pageGrid.CurrentPage-1)*pageGrid.PageSize %>
                        
                    </td>
                    <td>
                        <a class="aDelete" click="Delete('<%# Eval(FinReceiptMetadata.ColumnNames.ReceiptID) %>,')"></a>
                    </td>
                    <td>
                        <%# GetYesOrNo(Eval(FinReceiptMetadata.ColumnNames.IsSAP))%>
                    </td>
                    <td>
                        <%#Eval(VReceiptExtInfoMetadata.ColumnNames.BoxNo)%>
                    </td>
                    <td>
                        <%#Eval(VReceiptExtInfoMetadata.ColumnNames.SupplierBoxNo)%>
                    </td>                    
                    <td>
                        <%#Eval("VoucherDescriptionName")%>
                    </td>
                    <td>
                        <%# Eval(FinReceiptMetadata.ColumnNames.PostingDate).FormatDate(ConstantValue.DateFormat)%>
                    </td>
                    <td>
                        <%#Business.getNAString( Eval(FinReceiptMetadata.ColumnNames.DocumentsNo))%>
                    </td>
                    <td>
                        <%#Business.getNAString( Eval(FinReceiptMetadata.ColumnNames.Reference))%>
                    </td>
                    <td>
                        <%# Business.getNAString(Eval(FinReceiptMetadata.ColumnNames.ReferenceKey))%>
                    </td>
                    <td>
                        <%#Business.getNAString(Eval(FinReceiptMetadata.ColumnNames.DocumentHeaderText))%>
                    </td>
                    <td>
                        <%# Eval(BFCompanyDicMetadata.ColumnNames.CompanyCode)%>
                    </td>
                    <td>
                        <%# Eval(BFCompanyDicMetadata.ColumnNames.CompanyName)%></td>
                    <td>
                        <%#Eval(FinReceiptMetadata.ColumnNames.FunctionDept+"Str")%>
                    </td>
                    <td><%# Eval(FinReceiptMetadata.ColumnNames.StorageStatus+"Str")%>
                    </td>
                    <td>
                        <%# Eval(FinReceiptMetadata.ColumnNames.StorageLocation+"Str")%>
                    </td> 
                    
                    <td><%# Eval(FinReceiptMetadata.ColumnNames.EStorageStatus)%>
                    </td>                  
                    <td><%#Eval(FinReceiptMetadata.ColumnNames.FirstStorageDate).FormatDate(ConstantValue.DateFormat)%></td>
                    <td>
                        <%#Business.getYear(Eval(FinReceiptMetadata.ColumnNames.StoreStartDate))%>
                    </td>
                    <td>
                        <%#Eval(FinReceiptMetadata.ColumnNames.NeedStoreYear)%>
                    </td>
                    <td>
                        <%#Eval(FinReceiptMetadata.ColumnNames.DestoryDate)%>
                    </td>
                    <td>
                        <%# Eval(FinReceiptMetadata.ColumnNames.Comments)%>
                    </td>
                   
                </tr>
                <tr class="odd"  style="display:none" data-id="d<%# Container.ItemIndex +1 %>" >
                    <td colspan="2"><b>录入人</b></td>
                    <td colspan="5">
                        <%#Eval(FinReceiptMetadata.ColumnNames.CreatedBy)%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="Reversed With in SAP">冲销凭证号(SAP)</a></td>
                    <td colspan="4">
                        <%#Business.getNAString( Eval(FinReceiptMetadata.ColumnNames.RevesedBy))%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="Document Type in SAP">凭证类型(SAP)</a></td>
                    <td colspan="10">
                        <%# Eval(FinReceiptMetadata.ColumnNames.DocumentsType)%></td>
                </tr>
                <tr class="odd"  style="display:none" data-id="d<%# Container.ItemIndex +1 %>">
                    <td colspan="2"><b>录入时间</b></td>
                    <td colspan="5">
                        <%#Eval(FinReceiptMetadata.ColumnNames.CreatedDttm).FormatDate(ConstantValue.DateTimeFormat)%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="User Name in SAP">用户名(SAP)</a></td>
                    <td colspan="4">
                        <%#Eval(FinReceiptMetadata.ColumnNames.UserName)%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="Reference Trasact in SAP">业务类型(SAP)</a></td>
                    <td colspan="10">
                        <%# Eval(FinReceiptMetadata.ColumnNames.ReferenceTransact)%></td>
                </tr>
                <tr class="odd"  style="display:none" data-id="d<%# Container.ItemIndex +1 %>">
                    <td colspan="2"><b>转移记录</b></td>
                    <td colspan="5">
                        <%#Eval(FinReceiptMetadata.ColumnNames.TransferRecord)%></td>
                    
                    <td><a class="thTitle" href="#" onclick="return false;" title="Document Date in SAP">凭证日期(SAP)</a></td>
                    <td colspan="4">
                        <%# Eval(FinReceiptMetadata.ColumnNames.DocumentDate).FormatDate(ConstantValue.DateFormat)%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="Logical System in SAP">关联系统(SAP)</a></td>
                    <td colspan="10">
                        <%#Business.getNAString( Eval(FinReceiptMetadata.ColumnNames.LogicalSystem))%></td>
                    
                </tr>
                <tr class="odd"  style="display:none" data-id="d<%# Container.ItemIndex +1 %>">
                    <td colspan="2"><b>转移时间</b></td>
                    <td colspan="5"><%#Eval(FinReceiptMetadata.ColumnNames.LastTransferDate).FormatDate(ConstantValue.DateFormat)%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="Posting Date in SAP">凭证录入日期(SAP)</a>文档日期</td>
                    <td colspan="4">
                        <%# Eval(FinReceiptMetadata.ColumnNames.EntryDate).FormatDate(ConstantValue.DateFormat)%></td>
                    <td><a class="thTitle" href="#" onclick="return false;" title="这条凭证信息来自于哪个SAP系统">凭证系统(SAP)</a></td>
                    <td colspan="10">
                        <%# Eval(FinReceiptMetadata.ColumnNames.DocumentSystem)%></td>
                    
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </tbody> </table>
            </FooterTemplate>
        </yncWeb:PagnationGrid>
    </div>

    <asp:Button ID="btnDelete" runat="server" Text="删除" OnClick="btnDelete_Click" Style="display:none" />
    <asp:HiddenField ID="HiddenFieldIds" runat="server" />

    <script type="text/javascript">
        $("#tbSearch").hide();


        function showNews(msg) {
            alert(msg);
            window.location.href = "SAPFIn002d.aspx?boxId=<%=boxId%>&companyCode=<%=companyCode%>&companyName=<%=companyName%>";
        }
    </script> 
</asp:Content>

